class Solution:
    def generate(self, numRows: int) -> List[List[int]]:
        ans = []
        # 生成空三角
        for i in range(numRows):
            ret = []
            for j in range(i + 1):
                ret.append(None)
            ans.append(ret)
        # 赋值
        for i in range(len(ans)):
            for j in range(len(ans[i])):
                if j == 0 or j == len(ans[i]) - 1:
                    ans[i][j] = 1
                else:
                    ans[i][j] = ans[i - 1][j - 1] + ans[i - 1][j]
        return ans